home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
3.1
/
toasterall
/
arexx_examples
/
tpaint
/
tpmap.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-01-29
|
4KB
|
121 lines
/* TPMap.rexx -- Make texture map images for LightWave with edges that match */
/* By Arnie Cachelin © 1992 NewTek Inc. */
/*
This program will create an image which has matching left and right edges,
and top and bottom edges for use as texture maps in LightWave3D. The
program will cut a strip off the top of an image, flip it over, and
paste it on the bottom edge with transparency set to blend the inner side
of the brush smoothly into the image. It then repeats this process for
a strip on the left side. To use the program, makesure TPaint is
running, rexx is installed and this script is in the current directory
or in 'REXX:'. From a shell, simply type 'rx TPMap'. Optional
arguments specify a width for the strips that will be cut, an input
file name for an RGB image to load, and an output filename. If no
width is given, 128 is used, which works pretty well. If no in file is
given, the current paint canvas is used. If an input file is given, the
result is saved with .map appended.
*/
ARG dist infile outfile
PageWide=752
PageHigh=480
if pos('DigiPaint',show(ports))=0 then do
say "Can't find ToasterPaint!"
exit
end
Address "DigiPaint" /* Tell ARexx where commands go */
if dist="" then dist=128
if infile~="" then do
if ~exists(infile) then do
say "Can't find input image file "infile
exit
end
if outfile="" then outfile=infile".map"
Call LoadRGB(infile) /* if no name is given, use current screen! */
end
'Pmcl' /* Set to normal paint mode */
Call CutBrush(0,0,PageWide,dist) /* Cut brush along top */
'Fliy' /* Flip about x axis (reverse y) */
'Varr' /* Set to vertical gradient blend */
'Potv' 0 /* Set hotspot at top */
'Minc' /* Set Center transparency to 0% */
'Maxe' /* Set Edge transparency to 100% */
'Pend' PageWide/2 PageHigh-dist/2 /* Place brush */
'Penu' PageWide/2 PageHigh-dist/2
Call CutBrush(0,0,dist,PageHigh) /* cut brush along left side */
'Flix' /* Flip about y axis (reverse x) */
'Harr' /* Set to Horizontal gradient blend */
'Potv' 0 /* Set hotspot at left edge */
'Minc' /* Set Center transparency to 0% */
'Maxe' /* Set Edge transparency to 100% */
'Pend' PageWide-dist/2 PageHigh/2 /* Place brush */
'Penu' PageWide-dist/2 PageHigh/2
'Shco'
if outfile~="" then Call SaveRGB(outfile) /* if no name is given, use current screen! */
exit
CutBrush: PROCEDURE /* Cut out a brush with corners at (x1,y1) and (x2,y2) */
arg x1, y1, x2, y2
'Dotb' /* smallest brush size */
'Drre' /* Rectangle mode */
'Scis' /* Scissors on, for cutting a brush */
'Pend' x1 y1 /* Get in top Left corner */
'Penu' x2 y2 /* lift pen to get brush! */
return 0
SetFile: PROCEDURE /* Select file in current requester */
arg file
dirname=GetPathName(file)
'Dnam'dirname /* Enter file path */
'Dsel' /* Hit return on directory */
filename=GetFileName(file)
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return
LoadFrameStore: PROCEDURE /* Load FrameStore */
arg filename /* must have ###.fs on front! */
'Loco' /* Call file requester */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
SaveFrameStore: PROCEDURE /* Save FrameStore */
arg filename /* must have ###.fs on front! */
'Saco' /* Call file requester */
'Fnam'filename /* Enter File name */
'Okls' /* Hit the OK button */
return 0
LoadRGB: PROCEDURE /* Load IFF RGB, copy into swap buffer */
arg filename
'Lo24' /* Call file requester */
Call SetFile(filename)
return
SaveRGB: PROCEDURE /* Save IFF RGB, copy into swap buffer */
arg filename
'Sa24' /* Call file requester */
Call SetFile(filename)
return
GetFileName: procedure /* Extract file name from full file specification */
ARG fullfile
c = lastpos("/",fullfile)
if c = 0 then c = lastpos(":",fullfile)
return substr(fullfile, c + 1)
GetPathName: procedure /* Extract directory name from full file specification */
ARG fullfile
c = lastpos("/",fullfile)
if c = 0 then c = lastpos(":",fullfile)
return left(fullfile,c)